package com.lee.auth.sms;

import lombok.AllArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author Lee HN
 * @date 2020/10/7 16:27
 */
@Async
@Service
@AllArgsConstructor
public class SmsSenderHolder {

    private final SmsSender[] smsSenders;

    public void sendSms(String phone, SmsScene smsScene, Map<String, Object> smsParam) {
        for (SmsSender smsSender : smsSenders)
            if (smsSender.sendSms(phone, smsScene, smsParam)) break;
    }

}
